"""
Task 2

The sys module.

 The “sys.path” list is initialized from the PYTHONPATH environment variable. Is it possible to change it from within
 Python? If so, does it affect where Python looks for module files? Run some interactive tests to find it out. """

import sys, os
from pprint import pprint


def main():
    print("There are a list of sys.path")
    print(f"Sys path length: {len(sys.path)}")
    pprint(sys.path)
    print("Now let's try to import module from task_1 folder")
    task_1_module_import()

    sys.path.append(os.path.abspath("task_1/directory_with_modules"))
    print("\nThere are enlarged list of sys.path")
    print(f"Sys path new length: {len(sys.path)}")
    pprint(sys.path)
    print("Now let's try to import module from task_1 folder")
    task_1_module_import()


def task_1_module_import():
    try:
        import module_2
        print("Module imported successfully")
    except:
        print("Module not imported")


if __name__ == '__main__':
    main()
